
import java.util.ArrayList;
import java.util.List;
public class School {
    private List<Department> departments;
    private List<Student> students;

    public School() {
        this.departments = new ArrayList<>();
        this.students = new ArrayList<>();
    }

    public void addDepartment(Department department) {
        departments.add(department);
    }

    public void removeDepartment(Department department) {
        departments.remove(department);
    }

    public void addStudent(Student student) {
        students.add(student);
    }

    public void removeStudent(Student student) {
        students.remove(student);
    }

    public List<Department> getDepartments() {
        return departments;
    }

    public List<Student> getStudents() {
        return students;
    }
}

// Department类
 class Department {
    private List<Instructor> instructors;
    private List<Subject> subjects;

    public Department() {
        this.instructors = new ArrayList<>();
        this.subjects = new ArrayList<>();
    }

    public void addInstructor(Instructor instructor) {
        instructors.add(instructor);
    }

    public void removeInstructor(Instructor instructor) {
        instructors.remove(instructor);
    }

    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    public void removeSubject(Subject subject) {
        subjects.remove(subject);
    }

    public List<Instructor> getInstructors() {
        return instructors;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}

// Instructor类
 class Instructor {
    private String name;
    private List<Subject> subjects;

    public Instructor(String name) {
        this.name = name;
        this.subjects = new ArrayList<>();
    }

    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    public void removeSubject(Subject subject) {
        subjects.remove(subject);
    }

    public String getName() {
        return name;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}

// Subject类
 class Subject {
    private String title;
    private int credits;
    private List<Instructor> instructors;
    private List<Student> students;

    public Subject(String title, int credits) {
        this.title = title;
        this.credits = credits;
        this.instructors = new ArrayList<>();
        this.students = new ArrayList<>();
    }

    public void addInstructor(Instructor instructor) {
        instructors.add(instructor);
    }

    public void removeInstructor(Instructor instructor) {
        instructors.remove(instructor);
    }

    public void addStudent(Student student) {
        students.add(student);
    }

    public void removeStudent(Student student) {
        students.remove(student);
    }

    public String getTitle() {
        return title;
    }

    public int getCredits() {
        return credits;
    }

    public List<Instructor> getInstructors() {
        return instructors;
    }

    public List<Student> getStudents() {
        return students;
    }
}

// Student类
 class Student {
    private String name;
    private List<Subject> subjects;

    public Student(String name) {
        this.name = name;
        this.subjects = new ArrayList<>();
    }

    public void addSubject(Subject subject) {
        subjects.add(subject);
    }

    public void removeSubject(Subject subject) {
        subjects.remove(subject);
    }

    public String getName() {
        return name;
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}